<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>学生信息表</title>
    <style>
        tr {
            text-align: center;
        }
    </style>
</head>
<body>
<div class="container">
    <div class="row clearfix">
        <div class="col-md-12 column">
            <h1 align="center">学生信息详情页</h1>
            <hr size="20px" color="orange">
            <table width="800px" border="2px" align="center">
                <thead>
                <tr>
                    <th>
                        姓名
                    </th>
                    <th>
                        性别
                    </th>
                    <th>
                        学号
                    </th>
                    <th>
                        电话号码
                    </th>
                    <th>
                        班级
                    </th>
                    <th>
                        住址
                    </th>
                    <th>
                        操作
                    </th>
                </tr>
                </thead>
                <tbody id="tbdata">
                <tr>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td>
                        <a href="/admin/updateStudentById.do">修改</a>
                        <a href="/admin/deleteStudent.do?id=${res.data[re].id}">删除</a>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
    </div>
</div>
</body>
<script src="./js/jquery-2.1.0.js"></script>
<script>
    loadData();
    function loadData(){
        $.post("/admin/listStudent.do",function(res){
            console.log(res);
            if (res.code == 0) {
                $("#tbdata").html("");
                for (re in res.data) {
                    $("#tbdata").append(`
                    <tr>
                            <td>${res.data[re].name}</td>
                            <td>${res.data[re].gender}</td>
                            <td>${res.data[re].snumber}</td>
                            <td>${res.data[re].telephone}</td>
                            <td>${res.data[re].classId}</td>
                            <td>${res.data[re].address}</td>
                             <td>
                            <a href="/studentInfoById.html?id=${res.data[re].id}">修改</a>
                            <a href="/admin/deleteStudent.do?id=${res.data[re].id}">删除</a>
                        </td>
                        </tr>
                    `
                    );
                }
            }
        })

    }

</script>
</html>